home *** CD-ROM | disk | FTP | other *** search
-
- #include "main.h"
-
-
- //------------------------------------------------------------------
- // Name: DXFONT()
- // Desc: konstruktor
- //------------------------------------------------------------------
- DXFONT::DXFONT()
- {
- Font = NULL;
- }
-
- //------------------------------------------------------------------
- // Name: ~DXFONT()
- // Desc: destruktor
- //------------------------------------------------------------------
- DXFONT::~DXFONT()
- {
-
- if(Font != NULL)
- Font->Release();
- Font = NULL;
-
-
- }
- /*
- AtributeFlag - FW_NORMAL, FW_BOLD
- FontFace - Arial, CourierNew
- */
- //------------------------------------------------------------------
- // Name: Create()
- // Desc: inicializacia fontu
- //------------------------------------------------------------------
- void DXFONT::Create(int Size,DWORD AtributeFlag,char *FontFace)
- {
-
- LogPrint("Vytvaram DXFONT");
-
- HFONT hFont = CreateFont(Size, 0, 0, 0, AtributeFlag, false, false, false,
- DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
- DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial");
- if(!hFont)
- {
- LogPrint(" Chyba pri vytvarani fontu");
- }
-
- if(FAILED(D3DXCreateFont(g_pd3dDevice, hFont, &Font)))
- {
- LogPrint(" Chyba pri vytvarani fontu");
- }
-
- DeleteObject(hFont);
-
- FontPosition.top = 0;
- FontPosition.left = 0;
- FontPosition.right = Engine.Width;
- FontPosition.bottom = Engine.Height;
-
-
- }
-
- //------------------------------------------------------------------
- // Name: Print()
- // Desc: vytlacenie na obrazovku
- //------------------------------------------------------------------
- void DXFONT::Print(int x,int y,COLOR Color,char *Text)
- {
-
- FontPosition.left = x;
- FontPosition.top = y;
- Font->DrawText(TEXT(Text), -1, &FontPosition, DT_LEFT, D3DXCOLOR(Color.R,Color.G,Color.B,Color.A));
-
-
- }
-
- //------------------------------------------------------------------
- // Name: PrintCenter()
- // Desc: vytlacenie na obrazovku
- //------------------------------------------------------------------
- void DXFONT::PrintCenter(int x,int y,COLOR Color,char *Text)
- {
-
- FontPosition.left = 0;
- FontPosition.top = y;
- Font->DrawText(TEXT(Text), -1, &FontPosition, DT_CENTER, D3DXCOLOR(Color.R,Color.G,Color.B,Color.A));
-
-
- }
-
-
-
-